package Homework_03_31;

class person
{
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public person(String name) {
        this.name = name;
    }

    public person() {
    }

    public void drive(Vehicle1 car)
    {
        System.out.println(this.name + "会驾驶" + car.getBrand());
        return;
    }
}

abstract class Vehicle1
{
    private String brand;

    public Vehicle1() {
    }

    public Vehicle1(String brand) {
        this.brand = brand;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    abstract void run();
}

class car1 extends Vehicle1
{
    public car1() {
    }

    public car1(String brand) {
        super(brand);
    }

    public void run()
    {
        System.out.println("该车百公里加速需要10s");
    }
}

class car2 extends Vehicle1
{
    public car2() {
    }

    public car2(String brand) {
        super(brand);
    }

    public void run()
    {
        System.out.println("该车百公里加速需要5s");
    }
}

class car3 extends Vehicle1
{
    public car3() {
    }

    public car3(String brand) {
        super(brand);
    }

    public void run()
    {
        System.out.println("该车百公里加速需要2s");
    }
}
public class Main4 {
    public static void main(String[] args) {
        Vehicle1 car1 = new car1("qirui");
        Vehicle1 car2 = new car2("benchi");
        Vehicle1 car3 = new car3("baoma");
        System.out.println(car1.getBrand());
        car1.run();
        System.out.println(car2.getBrand());
        car2.run();
        System.out.println(car3.getBrand());
        car3.run();
        person p1 = new person("Jack");
        p1.drive(car1);
    }
}
